Skip to content

feat: reinstate title_prefix on all matplotlib subplot panel titles#333

Merged
Jammy2211 merged 4 commits intomainfrom
feature/title-prefix-subplots
Apr 7, 2026
Merged

feat: reinstate title_prefix on all matplotlib subplot panel titles#333
Jammy2211 merged 4 commits intomainfrom
feature/title-prefix-subplots

Conversation

@Jammy2211
Copy link
Copy Markdown
Collaborator

Summary

Analysis classes accept title_prefix: str = None to prefix every matplotlib subplot panel title (e.g. "VIS " gives "VIS Data", "VIS Signal-To-Noise Map" etc. for Euclid VIS imaging). This parameter was stored in all Analysis and Plotter classes but was never applied after a plot refactor — titles were hardcoded strings in the *_plots.py functions.

This PR reinstates the feature by threading self.title_prefix from every Plotter method down to every subplot_* plot function across all dataset types.

API Changes

New optional title_prefix: str = None parameter added to all subplot_* functions. When set, it is prepended to every panel title string before the title is passed to plot_array() / plot_visibilities_1d(). No existing arguments removed or renamed — fully backwards-compatible.

See full details below.

Test Plan

  • 811 unit tests pass (python -m pytest test_autogalaxy/ -x)
  • All affected modules import cleanly
  • Manual spot check: PlotterImaging(image_path=..., title_prefix="VIS ") should prefix all fit subplot titles
Full API Changes (for automation & release notes)

Added (new optional parameter — backwards-compatible)

All functions below gained title_prefix: str = None. When non-None the prefix is prepended to every subplot panel title.

autogalaxy/imaging/plot/fit_imaging_plots.py

  • subplot_fit(..., title_prefix=None)
  • subplot_of_galaxy(..., title_prefix=None)
  • subplot_fit_imaging_list(..., title_prefix=None)

autogalaxy/interferometer/plot/fit_interferometer_plots.py

  • subplot_fit(..., title_prefix=None)
  • subplot_fit_dirty_images(..., title_prefix=None)
  • subplot_fit_real_space(..., title_prefix=None)

autogalaxy/quantity/plot/fit_quantity_plots.py

  • _subplot_fit_array(..., title_prefix=None)
  • subplot_fit(..., title_prefix=None)

autogalaxy/galaxy/plot/galaxies_plots.py

  • subplot_galaxies(..., title_prefix=None)
  • subplot_galaxy_images(..., title_prefix=None)

autogalaxy/galaxy/plot/adapt_plots.py

  • subplot_adapt_images(..., title_prefix=None)

autogalaxy/ellipse/plot/fit_ellipse_plots.py

  • _plot_data(..., title_prefix=None)
  • subplot_fit_ellipse(..., title_prefix=None)

Changed Behaviour (Plotter methods now forward title_prefix)

All Plotter.* methods that call the above plot functions now pass title_prefix=self.title_prefix. No signature changes on the Plotter methods themselves.

Migration

No migration needed — all changes are additive with None defaults.

Closes #332

🤖 Generated with Claude Code

Analysis classes accept title_prefix: str = None to prefix every subplot
panel title (e.g. "VIS " gives "VIS Data", "VIS Signal-To-Noise Map").
This was stored but never applied after a plot refactor. Thread title_prefix
from Plotter.title_prefix down through all subplot_* plot functions across
imaging, interferometer, quantity, ellipse, galaxies, and adapt paths.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Jammy2211 and others added 3 commits April 7, 2026 19:28
All `_pf` lambdas now strip trailing whitespace from title_prefix and
insert a single space before the panel title, so callers can pass either
"VIS" or "VIS " and always get "VIS Data" (not "VISData" or "VIS  Data").

The same fix is applied to the `_title` pattern in fit_ellipse_plots.py.

PlotterImaging.imaging() and PlotterEllipse.imaging() now forward
`title_prefix=self.title_prefix` to `subplot_imaging_dataset` /
`subplot_imaging_dataset_list` so that dataset.png panels receive the
prefix when a title_prefix is set on the Plotter.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Jammy2211 Jammy2211 merged commit e483696 into main Apr 7, 2026
1 of 2 checks passed
@Jammy2211 Jammy2211 deleted the feature/title-prefix-subplots branch April 7, 2026 18:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: reinstate title_prefix on all matplotlib subplot panel titles

1 participant